package com.zigong.app.ui.utils;

import com.zigong.app.beans.FCityState;
import com.zigong.app.beans.FCountyState;

import java.util.ArrayList;
import java.util.List;

/**
 * 获取市州固定配置数据
 * zhangyong  2018/7/2
 */
public class CityContrastUtils {

    private static CityContrastUtils instance;

    public static CityContrastUtils getInstance() {
        if (null == instance) {
            instance = new CityContrastUtils();
        }
        return instance;
    }
//    http://192.168.60.240:8080/sctv/cityConfig.json 市州服务配置json地址
//    http://192.168.60.240:8080/sctv/appConfig.json app服务配置 json地址
    /**
     * 获取到城市以及对应的市州数据
     * @return
     */
    public List<FCityState> getCityStatList() {
        List<FCityState> stateList = new ArrayList<>();
        FCityState state = new FCityState();
        state.setCityName("四川观察");
        stateList.add(state);
        state = new FCityState();
        state.setCityName("成都市");
        state.setHot("42");
        state.setHotLevel("0");
        state.setInstitutionId("1084");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170918184413_exrmpemmck.png");
        state.setInstitutionName("一头条");
        state.setInstitutionUrl("/sctv/city/1084/index/1084.json");
        stateList.add(state);
        state = new FCityState();
        state.setHot("1035");
        state.setHotLevel("0");
        state.setInstitutionId("1071");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170915171153_g4atw49yqy.jpg");
        state.setInstitutionName("乐事TV");
        state.setInstitutionUrl("/sctv/city/leshan/index/leshan.json");
        state.setCityName("乐山市");
        stateList.add(state);
        state = new FCityState();
        state.setHot("599");
        state.setHotLevel("0");
        state.setInstitutionId("1022");
        state.setInstitutionImage("/sctv/1/image/public/201712/20171206180242_k4h8d4dqlj.png");
        state.setInstitutionName("圣洁甘孜");
        state.setInstitutionUrl("sctv/city/ganzi/index/ganzi.json");
        state.setCityName("甘孜州");
        stateList.add(state);
        state = new FCityState();
        state.setHot("1714");
        state.setHotLevel("0");
        state.setInstitutionId("530");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170914160307_oimmdlv7hf.jpg");
        state.setInstitutionName("直播绵阳");
        state.setInstitutionUrl("/sctv/city/530/index/530.json");
        state.setCityName("绵阳市");
        stateList.add(state);
        state = new FCityState();
        state.setHot("35");
        state.setHotLevel("0");
        state.setInstitutionId("531");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170914160215_p1v20upkle.jpg");
        state.setInstitutionName("德阳全媒体");
        state.setInstitutionUrl("/sctv/city/531/index/531.json");
        state.setCityName("德阳市");
        stateList.add(state);
        state = new FCityState();
        state.setHot("119");
        state.setHotLevel("0");
        state.setInstitutionId("532");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170914181450_mqwn2wfljr.png");
        state.setInstitutionName("美丽阿坝");
        state.setInstitutionUrl("/sctv/city/532/index/532.json");
        state.setCityName("阿坝州");
        stateList.add(state);
        state = new FCityState();
        state.setHot("210");
        state.setHotLevel("0");
        state.setInstitutionId("542");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170914160129_21b0s7jphh.png");
        state.setInstitutionName("达州全搜索");
        state.setInstitutionUrl("/sctv/city/dazhou/index/dazhou.json");
        state.setCityName("达州市");
        stateList.add(state);
        state = new FCityState();
        state.setHot("578");
        state.setHotLevel("0");
        state.setInstitutionId("533");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170914160113_3cchh50dmw.jpg");
        state.setInstitutionName("智慧眉山");
        state.setInstitutionUrl("/sctv/city/meishan/index/meishan.json");
        state.setCityName("眉山市");
        stateList.add(state);
        state = new FCityState();
        state.setHot("51");
        state.setHotLevel("0");
        state.setInstitutionId("544");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170914160044_2a54ve6gg8.jpg");
        state.setInstitutionName("直播遂宁");
        state.setInstitutionUrl("/sctv/city/suining/index/suining.json");
        state.setCityName("遂宁市");
        stateList.add(state);
        state = new FCityState();
        state.setHot("130");
        state.setHotLevel("0");
        state.setInstitutionId("1020");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170914155957_ql437k6ptl.png");
        state.setInstitutionName("广元大话利州");
        state.setInstitutionUrl("/sctv/city/guangyuan/index/guangyuan.json");
        state.setCityName("广元市");
        List<FCountyState> countyStateList = new ArrayList<>();
        FCountyState c = new FCountyState();
        c.setHot("130");
        c.setHotLevel("0");
        c.setInstitutionId("1020");
        c.setInstitutionImage("/sctv/1/image/public/201709/20170914155957_ql437k6ptl.png");
        c.setInstitutionName("苍溪广播电视台");
        c.setInstitutionUrl("/sctv/city/guangyuan/index/guangyuan.json");
        c.setCountyName("苍溪县");
        countyStateList.add(c);
//        state.setCountyStateList(countyStateList);
        stateList.add(state);
        state = new FCityState();
        state.setHot("36");
        state.setHotLevel("0");
        state.setInstitutionId("1023");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170914155004_be45b69b68.png");
        state.setInstitutionName("甜橙内江");
        state.setInstitutionUrl("/sctv/city/neijiang/index/neijiang.json");
        state.setCityName("内江市");
        stateList.add(state);
        state = new FCityState();
        state.setHot("91");
        state.setHotLevel("0");
        state.setInstitutionId("1024");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170914154147_fiwsedf0ow.jpg");
        state.setInstitutionName("无线宜宾");
        state.setInstitutionUrl("/sctv/city/yibin/index/yibin.json");
        state.setCityName("宜宾市");
        stateList.add(state);
        state = new FCityState();
        state.setHot("735");
        state.setHotLevel("0");
        state.setInstitutionId("1025");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170914154716_33fyf8oggm.png");
        state.setInstitutionName("直播盐都");
        state.setInstitutionUrl("/sctv/city/zigong/index/zigong.json");
        state.setCityName("自贡市");
        stateList.add(state);
        state = new FCityState();
        state.setHot("1236");
        state.setHotLevel("0");
        state.setInstitutionId("1026");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170915161622_uhsdut5psg.png");
        state.setInstitutionName("掌上资阳");
        state.setInstitutionUrl("/sctv/city/ziyang/index/ziyang.json");
        state.setCityName("资阳市");
        stateList.add(state);
        state = new FCityState();
        state.setHot("43");
        state.setHotLevel("0");
        state.setInstitutionId("1081");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170918183830_b3priae90b.jpg");
        state.setInstitutionName("直播泸州");
        state.setInstitutionUrl("/sctv/city/1081/index/1081.json");
        state.setCityName("泸州市");
        stateList.add(state);
        state = new FCityState();
        state.setHot("16");
        state.setHotLevel("0");
        state.setInstitutionId("1083");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170918184030_l7ttlmnjxt.png");
        state.setInstitutionName("无线巴中");
        state.setInstitutionUrl("/sctv/city/1083/index/1083.json");
        state.setCityName("巴中市");
        stateList.add(state);
        state = new FCityState();
        state.setHot("14");
        state.setHotLevel("0");
        state.setInstitutionId("1085");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170918184503_6t2m8e957a.jpg");
        state.setInstitutionName("广安播报");
        state.setInstitutionUrl("/sctv/city/1085/index/1085.json");
        state.setCityName("广安市");
        stateList.add(state);
        state = new FCityState();
        state.setHot("50");
        state.setHotLevel("0");
        state.setInstitutionId("1088");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170918185005_g70qcl6x86.png");
        state.setInstitutionName("攀枝花手机台");
        state.setInstitutionUrl("/sctv/city/1088/index/1088.json");
        state.setCityName("攀枝花市");
        stateList.add(state);
        state = new FCityState();
        state.setHot("1572");
        state.setHotLevel("0");
        state.setInstitutionId("1090");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170918185220_xhpb1p2teq.png");
        state.setInstitutionName("无线雅安");
        state.setInstitutionUrl("/sctv/city/1090/index/1090.json");
        state.setCityName("雅安市");
        stateList.add(state);
        state = new FCityState();
        state.setHot("1016");
        state.setHotLevel("0");
        state.setInstitutionId("1091");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170918185254_alsuqfl41l.png");
        state.setInstitutionName("掌上凉山");
        state.setInstitutionUrl("/sctv/city/1091/index/1091.json");
        state.setCityName("凉山州");
        stateList.add(state);
        state = new FCityState();
        state.setHot("16");
        state.setHotLevel("0");
        state.setInstitutionId("1092");
        state.setInstitutionImage("/sctv/1/image/public/201709/20170918185317_m6v20pivap.png");
        state.setInstitutionName("直播南充");
        state.setInstitutionUrl("/sctv/city/1092/index/1092.json");
        state.setCityName("南充市");
        stateList.add(state);
        return stateList;
    }


    /**
     * 对照获取市州的FCityState
     *
     * @param cityCode
     * @return
     */
    public FCityState getCityState(String cityCode) {
        FCityState state = new FCityState();
        switch (cityCode) {
            case "" + 75:
                state.setCityName("成都");
                state.setHot("42");
                state.setHotLevel("0");
                state.setInstitutionId("1084");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170918184413_exrmpemmck.png");
                state.setInstitutionName("一头条");
                state.setInstitutionUrl("/sctv/city/1084/index/1084.json");
                break;
            case "" + 78:
                state.setHot("735");
                state.setHotLevel("0");
                state.setInstitutionId("1025");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170914154716_33fyf8oggm.png");
                state.setInstitutionName("直播盐都");
                state.setInstitutionUrl("/sctv/city/zigong/index/zigong.json");
                state.setCityName("自贡");
                break;
            case "" + 81:
                state.setHot("50");
                state.setHotLevel("0");
                state.setInstitutionId("1088");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170918185005_g70qcl6x86.png");
                state.setInstitutionName("攀枝花手机台");
                state.setInstitutionUrl("/sctv/city/1088/index/1088.json");
                state.setCityName("攀枝花");
                break;
            case "" + 331:
                state.setHot("43");
                state.setHotLevel("0");
                state.setInstitutionId("1081");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170918183830_b3priae90b.jpg");
                state.setInstitutionName("直播泸州");
                state.setInstitutionUrl("/sctv/city/1081/index/1081.json");
                state.setCityName("泸州");
                break;
            case "" + 74:
                state.setHot("35");
                state.setHotLevel("0");
                state.setInstitutionId("531");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170914160215_p1v20upkle.jpg");
                state.setInstitutionName("德阳全媒体");
                state.setInstitutionUrl("/sctv/city/531/index/531.json");
                state.setCityName("德阳");
                break;
            case "" + 240:
                state.setHot("1714");
                state.setHotLevel("0");
                state.setInstitutionId("530");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170914160307_oimmdlv7hf.jpg");
                state.setInstitutionName("直播绵阳");
                state.setInstitutionUrl("/sctv/city/530/index/530.json");
                state.setCityName("绵阳");
                break;
            case "" + 329:
                state.setHot("130");
                state.setHotLevel("0");
                state.setInstitutionId("1020");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170914155957_ql437k6ptl.png");
                state.setInstitutionName("广元大话利州");
                state.setInstitutionUrl("/sctv/city/guangyuan/index/guangyuan.json");
                state.setCityName("广元");
                break;
            case "" + 330:
                state.setHot("51");
                state.setHotLevel("0");
                state.setInstitutionId("544");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170914160044_2a54ve6gg8.jpg");
                state.setInstitutionName("直播遂宁");
                state.setInstitutionUrl("/sctv/city/suining/index/suining.json");
                state.setCityName("遂宁");
                break;
            case "" + 248:
                state.setHot("36");
                state.setHotLevel("0");
                state.setInstitutionId("1023");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170914155004_be45b69b68.png");
                state.setInstitutionName("甜橙内江");
                state.setInstitutionUrl("/sctv/city/neijiang/index/neijiang.json");
                state.setCityName("内江");
                break;
            case "" + 79:
                state.setHot("1035");
                state.setHotLevel("0");
                state.setInstitutionId("1071");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170915171153_g4atw49yqy.jpg");
                state.setInstitutionName("乐事TV");
                state.setInstitutionUrl("/sctv/city/leshan/index/leshan.json");
                state.setCityName("乐山");
                break;
            case "" + 291:
                state.setHot("16");
                state.setHotLevel("0");
                state.setInstitutionId("1092");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170918185317_m6v20pivap.png");
                state.setInstitutionName("直播南充");
                state.setInstitutionUrl("/sctv/city/1092/index/1092.json");
                state.setCityName("南充");
                break;
            case "" + 77:
                state.setHot("578");
                state.setHotLevel("0");
                state.setInstitutionId("533");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170914160113_3cchh50dmw.jpg");
                state.setInstitutionName("智慧眉山");
                state.setInstitutionUrl("/sctv/city/meishan/index/meishan.json");
                state.setCityName("眉山");
                break;
            case "" + 186:
                state.setHot("91");
                state.setHotLevel("0");
                state.setInstitutionId("1024");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170914154147_fiwsedf0ow.jpg");
                state.setInstitutionName("无线宜宾");
                state.setInstitutionUrl("/sctv/city/yibin/index/yibin.json");
                state.setCityName("宜宾");
                break;
            case "" + 241:
                state.setHot("14");
                state.setHotLevel("0");
                state.setInstitutionId("1085");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170918184503_6t2m8e957a.jpg");
                state.setInstitutionName("广安播报");
                state.setInstitutionUrl("/sctv/city/1085/index/1085.json");
                state.setCityName("广安");
                break;
            case "" + 369:
                state.setHot("210");
                state.setHotLevel("0");
                state.setInstitutionId("542");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170914160129_21b0s7jphh.png");
                state.setInstitutionName("达州全搜索");
                state.setInstitutionUrl("/sctv/city/dazhou/index/dazhou.json");
                state.setCityName("达州");
                break;
            case "" + 76:
                state.setHot("1572");
                state.setHotLevel("0");
                state.setInstitutionId("1090");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170918185220_xhpb1p2teq.png");
                state.setInstitutionName("无线雅安");
                state.setInstitutionUrl("/sctv/city/1090/index/1090.json");
                state.setCityName("雅安");
                break;
            case "" + 239:
                state.setHot("16");
                state.setHotLevel("0");
                state.setInstitutionId("1083");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170918184030_l7ttlmnjxt.png");
                state.setInstitutionName("无线巴中");
                state.setInstitutionUrl("/sctv/city/1083/index/1083.json");
                state.setCityName("巴中");
                break;
            case "" + 242:
                state.setHot("1236");
                state.setHotLevel("0");
                state.setInstitutionId("1026");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170915161622_uhsdut5psg.png");
                state.setInstitutionName("掌上资阳");
                state.setInstitutionUrl("/sctv/city/ziyang/index/ziyang.json");
                state.setCityName("资阳");
                break;
            case "" + 185:
                state.setHot("119");
                state.setHotLevel("0");
                state.setInstitutionId("532");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170914181450_mqwn2wfljr.png");
                state.setInstitutionName("美丽阿坝");
                state.setInstitutionUrl("/sctv/city/532/index/532.json");
                state.setCityName("阿坝藏族羌族自治州");
                break;
            case "" + 73:
                state.setHot("599");
                state.setHotLevel("0");
                state.setInstitutionId("1022");
                state.setInstitutionImage("/sctv/1/image/public/201712/20171206180242_k4h8d4dqlj.png");
                state.setInstitutionName("圣洁甘孜");
                state.setInstitutionUrl("sctv/city/ganzi/index/ganzi.json");
                state.setCityName("甘孜藏族自治州");
                break;
            case "" + 80:
                state.setHot("1016");
                state.setHotLevel("0");
                state.setInstitutionId("1091");
                state.setInstitutionImage("/sctv/1/image/public/201709/20170918185254_alsuqfl41l.png");
                state.setInstitutionName("掌上凉山");
                state.setInstitutionUrl("/sctv/city/1091/index/1091.json");
                state.setCityName("凉山彝族自治州");
                break;
        }
        return state;
    }

    /**
     * 是否是泸州市
     *
     * @param cityCode
     * @return
     */
    public boolean isLZ(String cityCode) {
        if ("331".equalsIgnoreCase(cityCode)) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * 是否为成都
     * @param cityCode
     * @return
     */
    public boolean isChDu(String cityCode) {
        if ("75".equalsIgnoreCase(cityCode)) {
            return true;
        } else {
            return false;
        }
    }
}
